package xyz.riceball.exception;

/**
 * <p>
 *
 * </p>
 *
 * @author xiaovcloud
 * @since 2021/7/1 13:27
 */
public class NoSuchBeanDefinitionException extends RuntimeException {

    private final String beanName;

    private final Class<?> requestType;

    public String getBeanName() {
        return this.beanName;
    }

    public Class<?> getRequestType() {
        return requestType;
    }

    public NoSuchBeanDefinitionException(String beanName) {
        super("没有名为【" + beanName + "】的bean定义信息");
        this.beanName = beanName;
        this.requestType = null;
    }

    public NoSuchBeanDefinitionException(String beanName, Exception t) {
        super("没有名为【" + beanName + "】的bean定义信息", t);
        this.beanName = beanName;
        this.requestType = null;
    }

    public NoSuchBeanDefinitionException(Class<?> requestType) {
        super("没有类型为【" + requestType + "】的bean定义信息");
        this.beanName = null;
        this.requestType = requestType;
    }

    public NoSuchBeanDefinitionException(Class<?> requestType, String message) {
        super("没有类型为【" + requestType + "】的bean定义信息 , 可用的：" + message);
        this.beanName = null;
        this.requestType = requestType;
    }

    public NoSuchBeanDefinitionException(Class<?> requestType, Exception t) {
        super("没有类型为【" + requestType + "】的bean定义信息", t);
        this.beanName = null;
        this.requestType = requestType;
    }

    public NoSuchBeanDefinitionException(String beanName, Class<?> requestType) {
        super("没有名为【" + beanName + "】,类型为【" + requestType + "】的bean定义信息");
        this.beanName = beanName;
        this.requestType = requestType;
    }

    public NoSuchBeanDefinitionException(String beanName, Class<?> requestType, Exception t) {
        super("没有名为【" + beanName + "】,类型为【" + requestType + "】的bean定义信息");
        this.beanName = beanName;
        this.requestType = requestType;
    }
}
